package com.baby.springboot.consumer;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import sun.awt.SunHints;

@Component
public class PublishConsumer {


    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
            exchange = @Exchange(
                    value = "com.baby",
                    type = "fanout"
            ))
    })
    public void consumer1(String massage){
        System.out.println("一号:"+massage);
    }

    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
            exchange = @Exchange(value = "com.baby",
            type = "fanout"))
    })
    public void consumer2(String massage){
        System.out.println("消息二号:"+massage);
    }

}
